package xrc.service.impl;

import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigInteger;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class test {


    static MaskVoteImpl contract = new MaskVoteImpl();

    public static void main(String[] args) throws SQLException, ClassNotFoundException, ParseException {
        /*Connection connection = contract.connection();
        String name = "16011003";
        String sql = "SELECT * FROM EVENT";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()){
            String username = resultSet.getString("username");
            if (username.equals(name)){
                String voteId = resultSet.getString("voteId");
                System.out.println("voteId = " + voteId);
                String voteItem = resultSet.getString("voteItem");
                System.out.println("voteItem = " + voteItem);
                String timePrevoteStart = resultSet.getString("timePrevoteStart");
                System.out.println("timePrevoteStart = " + timePrevoteStart);
                String sum = resultSet.getString("Sum");
                System.out.println(sum);
            }

        }*/
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date1 = sdf.parse("2009-12-31");
        Date date2 = sdf.parse("2019-01-31");

        System.out.println("date1 : " + sdf.format(date1));
        System.out.println("date2 : " + sdf.format(date2));

        if (date1.compareTo(date2) > 0) {
            System.out.println("Date1 时间在 Date2 之后");
        } else if (date1.compareTo(date2) < 0) {
            System.out.println("Date1 时间在 Date2 之前");
        } else if (date1.compareTo(date2) == 0) {
            System.out.println("Date1 时间与 Date2 相等");
        } else {
            System.out.println("程序怎么会运行到这里?正常应该不会");
        }

    }

}
